﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Delay
{
    public class TypeParameter:DependencyObject, INotifyPropertyChanged
    {
        public TypeParameter()
        {
            _typeParameterItems = new ObservableCollection<PhoneInfoCenterItem>();
        }
        private ObservableCollection<PhoneInfoCenterItem> _typeParameterItems;
        public ObservableCollection<PhoneInfoCenterItem> TypeParameterItems
        {
            get
            {
                return _typeParameterItems;
            }
            set
            {
                if (_typeParameterItems != value)
                {
                    _typeParameterItems = value;
                    NotifyPropertyChanged("TypeParameterItems");
                }
            }
        }
        //
        private bool _imageVis;
        public bool ImageVis
        {
            get
            {
                return _imageVis;
            }
            set
            {
                if (_imageVis != value)
                {
                    _imageVis = value;
                    NotifyPropertyChanged("ImageVis");
                }
            }
        }
        //
        public string GetPhoneInfoUrl(string pid)
        {
            string url = QueryXml.PhoneTypeParameterUrl;
            url += ("imei=" + QueryXml.imei);
            url += ("&phonename=" + QueryXml.phonename);
            url += ("&phonevs=" + QueryXml.phonevs);
            url += ("&phonevsno=" + QueryXml.phonevsno);
            url += ("&keyvalue=" + QueryXml.keyvalue);
            url += ("&channelkey=" + QueryXml.channelkey);
            url += ("&pid=" + pid);
            return url;
        }
        //
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
